<template>
	<view class="review">
		<navbar title="我的参赛项目"></navbar>
		
		<view class="cate-nav" :style="{ top: sysHeight+'px' }">
			<view class="nav acea-row row-around">
				<view class="item" :class="type==0?'on':''" @click="typeClick(0)">参赛中</view>
				<view class="item" :class="type==1?'on':''" @click="typeClick(1)">已结束</view>
			</view>
		<!-- 	<view class="search acea-row row-middle row-center themecolor">
				<text class="iconfont icon-sousuoxiao"></text>
				<input type="text" placeholder="请输入姓名" placeholder-class="themecolor fs28" />
			</view> -->
		</view>
		<view style="width: 100%;height: 100rpx;"></view>
		
		<view class="list p30">
			<block v-for="(item,index) in prolist" :key="index">
				<view class="item bgwhite mb30" @click.stop="urlClick(`/pages/home/application-details?id=${item.huodong_id}`)">
					<view class="picture">
						<image class="imgwh" src="https://yuchengpic.oss-cn-hangzhou.aliyuncs.com/img/001.png" mode=""></image>
						<text class="tips-left fs30">{{ item.stageName }}</text>
						<!-- <text class="num">报名人数:{{ item.baomingCount }}人</text> -->
					</view>
					<view class="p30">
						<view class="acea-row row-between-wrapper">
							<view class="title bold fs32 line1">{{ item.title }}</view>
							<!-- <view class="baoming fs26 acea-row row-middle row-center">{{ item.xiangqingData.statusName }}</view> -->
						</view>
						<view class="subtitle fs26 fc333 line2 mt10">
							{{ item.synopsis }}
						</view> 
						<view class="acea-row row-between mt20">
							<view>	
								<view class="word-wrap" style="width: 400rpx;">
									<text class="iconfont icon-wxbdingwei fc222 fs32"></text>
									<text class="ml10 fs28 fc333">{{ item.baoming_to_address }}</text>
								</view>
								<view class="daohang acea-row row-middle row-center themecolor mt10" @click.stop="openlocation(item)">
									<text class="iconfont icon-daohang"></text>
									<text class="fs24 ml10">导航</text>
								</view>
							</view>
							<view class="detail acea-row row-middle row-center fcwhite fs26">查看详情</view>
						</view>
					</view>
				</view>
			</block>
			<view class='loadingicon acea-row row-center-wrapper fs26' v-if="prolist.length>0">
				<text class='loading iconfont icon-jiazai' :hidden='loading==false'></text>{{loadTitle}}
			</view>
		</view>
		
		<pagenone title="暂无比赛呢~" v-if="prolist.length==0"></pagenone>
		
	</view>
</template>

<script>
	import{
		myInletList
	} from '@/api/other.js'
	let sysHeight = uni.getSystemInfoSync().statusBarHeight;
	import pagenone from '../../components/pagenone.vue'
	import navbar from '../../components/navbar.vue'
	export default {
		components:{
			navbar,
			pagenone
		},
		data() {
			return {
				sysHeight: sysHeight+48,
				type:0,
				loadend: false,
				loading: false,
				loadTitle: this.$t(`加载更多`),
				page:1,
				limit:10,
				prolist:[],
			};
		},
		onLoad(option){
			this.type = option.type || 0 ;
			this.getlist();
		},
		methods:{
			openlocation(item){
				this.$util.openlocation(item.latitude,item.longitude);
			},
			empty(){
				this.loadend = false;
				this.loading = false;
				this.page = 1;
				this.loadTitle = '没有更多内容啦~';
				this.prolist = [];
				this.getlist();
			},
			getlist(){
				let that = this;
				if (that.loadend) return;
				if (that.loading) return;
				myInletList({ 
					page:that.page, 
					limit:that.limit,
					is_fangbang: that.type
				}).then(res=>{
					let list = res.data.data.list;
					let prolist = that.$util.SplitArray(list, that.prolist);
					let loadend = list.length < that.limit;
					that.loadend = loadend;
					that.loading = false;
					that.loadTitle = loadend ? that.$t(`没有更多内容啦~`) : that.$t(`加载更多`);
					that.$set(that, 'prolist', prolist);
					that.$set(that, 'page', that.page + 1);
				}).catch(err=>{
					that.loading = false;
					that.loadTitle = that.$t(`加载更多`);
				})
			},
			urlClick(url){
				uni.navigateTo({
					url: url
				})
			},
			typeClick(val){
				this.type = val;
				this.empty();
			}
		},
		onReachBottom(){
			this.getlist();
		}
	}
</script>

<style lang="scss">
	.review{
		
		.cate-nav{
			position: fixed;
			left: 0;
			right: 0;
			z-index: 999;
			background-color: #f2f2f2;
			padding-top: 4rpx;
			
			.nav{
				width: 100%;
				background-color: #ffffff;
				
				.item{
					width: 50%;
					line-height: 88rpx;
					text-align: center;
					color: #666666;
					font-size: 32rpx;
					
					&.on{
						color: #6252DF;
						border-bottom: 4rpx solid #6252DF;
					}
				}
			}
			.search{
				width: 690rpx;
				height: 88rpx;
				background: rgba(98, 82, 223, 0.08);
				border: 1rpx solid #6252DF;
				border-radius: 44rpx;
				margin: 30rpx auto;
				
				input{
					margin-left: 10rpx;
					margin-right: -140rpx;
				}
			}
		}
		
		.list{
			background: #F4F4F4;
			
			.item{
				width: 100%;
				border-radius: 20rpx;
				overflow: hidden;
				
				.picture{
					width: 100%;
					height: 344rpx;
					position: relative;
					
					.tips-left{
						min-width: 144rpx;
						max-width: 200rpx;
						height: 64rpx;
						border-radius: 20rpx 0 20rpx 0;
						background: #6252DF;
						position: absolute;
						top: 0;
						left: 0;
						right: 0;
						text-align: center;
						line-height: 64rpx;
						color: #ffffff;
					}
					.num{
						width: 200rpx;
						height: 60rpx;
						border-radius: 154rpx;
						background: rgba(0, 0, 0, 0.6);
						text-align: center;
						line-height: 60rpx;
						color: #ffffff;
						font-size: 22rpx;
						position: absolute;
						bottom: 30rpx;
						left: 30rpx;
					}
				}
				
				.title{
					width: 458rpx;
				}
				.baoming{
					width: 140rpx;
					height: 58rpx;
					border-radius: 16rpx;
					background: rgba(51, 102, 255, 0.3);
					color: #3366FF;
				}
				.subtitle{
					width: 458rpx;
				}
				.daohang{
					width: 144rpx;
					height: 60rpx;
					border-radius: 68rpx;
					background: rgba(98, 82, 223, 0.3);
				}
				.detail{
					width: 200rpx;
					height: 60rpx;
					border-radius: 68rpx;
					background: #6252DF;
				}
		
			}
			
		}
		
		
	}
</style>
